#!/usr/bin/perl
my $query;
my $subject;
while (<>)
{
	if (/^Query: +\d+ +(\S+).*/)
	{
		$query .= $1;
	}
	elsif (/^Sbjct: +\d+ +(\S+).*/)
	{
		$subject .= $1
	}
}
print "$query\n$subject\n";
